<HTML><BODY><PRE>
&lt;!--METADATA NAME="TeeChart Pro v2024 ActiveX Control" TYPE="TypeLib" UUID="{DE7847A7-A266-4AA9-AA68-16676652C9DB}"--&gt;
&lt;%@ LANGUAGE="JavaScript" %&gt;

&lt;%
  //***************************************************************
  // Script starting point. Run script with no parameters to create
  // The page that recalls the script to obtain the Chart.
  //***************************************************************
  if (Request.QueryString('CreateChart')==1){
    Response.BinaryWrite(RunChart);
  }
  else{
    CreatePage();
  }

  function RunChart(){
    var TChart1;
    var SeriesTextSource1;
    var FolderStr;
    var AppPath;

    TChart1=Server.CreateObject('TeeChart.TChart');
    SeriesTextSource1 = Server.CreateObject('TeeChart.SeriesTextSource');

    // Set some Chart display characteristics
    TChart1.Aspect.Orthogonal=false;
    TChart1.Aspect.Rotation=345;
    TChart1.Aspect.Elevation=345;
    TChart1.Aspect.Perspective=37;
    TChart1.Aspect.Zoom=80;
    TChart1.Aspect.Chart3DPercent=60;
    TChart1.Legend.Visible=false;
    TChart1.Width=500;
    TChart1.Height=350;
    TChart1.Panel.Gradient.Visible=true;
    TChart1.Axis.Depth.Visible=true;
    TChart1.Axis.Left.Increment = 0.4;

    TChart1.AddSeries(scSurface);
    TChart1.Series(0).asSurface.IrregularGrid=true;

    //***************************************************************
    // AddField first param refers to the Series ValueList name
    // The AIndex refers to the Column index of the text file
    // beginning with Column 1
    //***************************************************************
    SeriesTextSource1.AddField('X', 1);
    SeriesTextSource1.AddField('Y', 2);
    SeriesTextSource1.AddField('Z', 3);

    //***************************************************************
    // We found that APPL_PHYSICAL_PATH returned different paths on
    // different operating platforms! So, just in case, check the path
    // to import the Series text data file .....
    //***************************************************************
    // +'**' used to convert FolderStr to string type (there must be
    // a better way!).
    FolderStr=Request.Servervariables('APPL_PHYSICAL_PATH')+'**';
    if (FolderStr.indexOf('TeeChartAX')&gt;0) {
      FolderStr=PreparePath(FolderStr);
    }
    else {
      FolderStr=PreparePath(FolderStr) + 'TeeChartAX\\\\';
    }

    // This just checks to see how the decimal separator is setup on your
    // server then selects the appropriate format file.
    if (TChart1.Environment.DecimalSeparator==',') {
      SeriesTextSource1.FileName = FolderStr + 'SampleData.txt'
    }
    else {
      SeriesTextSource1.FileName = FolderStr + 'SampleDataPoint.txt'
    }

    //***************************************************************
    // Activate data source for the Series
    //***************************************************************
    SeriesTextSource1.FieldSeparator=';';
    SeriesTextSource1.Series = TChart1.Series(0);
    SeriesTextSource1.Active = true;

    //***************************************************************
    // Export Chart
    //***************************************************************
    Response.BinaryWrite(TChart1.Export.asPNG.SaveToStream());
  }

  function PreparePath(Instr){
      Instr = Instr.replace('**','');
      while (Instr.indexOf('\\')&gt;0){
          Instr = Instr.replace('\\','**');
      }
      while (Instr.indexOf('**')&gt;0){
        Instr = Instr.replace('**','\\\\');
      }
     return(Instr);
  }

  function CreatePage(){
    Response.Expires = 0;
    Response.Write('&lt;html&gt;');
    Response.Write('&lt;HEAD&gt;&lt;title&gt;TeeChart Pro AX Control- importing serverside text files with JScript&lt;/title&gt;');
    Response.Write('&lt;LINK REL=STYLESHEET TYPE=\'text/css\' HREF=\'Style.css\'&gt;&lt;/HEAD&gt;&lt;BODY&gt;');
    Response.Write('&lt;img src=\'TeeChartAX300x66.jpg\'&gt;');
    Response.Write('&lt;br&gt;&lt;br&gt;');
    Response.Write('&lt;a href=\'ASPHome.htm\'&gt;Back to Contents page&lt;/a&gt;');
    Response.Write('&lt;hr&gt;');
    Response.Write('&lt;img id= Img1src=\'SeriesTextSrcJava.asp?CreateChart=1\'&gt;');
    Response.Write('&lt;HR&gt;Copyright (c) 2024 Steema Software SL&lt;/BODY&gt;&lt;/HTML&gt;');
    Response.Write('&lt;/body&gt;');
    Response.Write('&lt;/html&gt;');
  }
%&gt;
</PRE></BODY></HTML>
